<!DOCTYPE html>
<html lang="ch" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8"/>
    <title>Saas退单管理</title>
    <style type="text/css">
        body
        {
            background-size: cover;
        }
    </style>
    <script>
        window.onload=function ()
        {
            const mySelect = document.getElementById("mySelect");
            const opts = mySelect.options;
            for (let i = 0; i < opts.length; i++) {
                if (opts[i].value == ${sta!'0'}) {
                    opts[i].selected = true;
                }
            }
        }
    </script>

</head>

<body background="/static/img/buy_SpongeBobSquarePants5.jpg">
<div class="div_search" align="center">
    <span>
        <form action="/buy/getBackList" method="post">
             起止时间：
            <input type="date"  name="beginTime" value="${beg?if_exists}"/>
             截止时间
            <input type="date"  name="endTime" value="${end?if_exists}"/>
             供货商:
            <input type="text"  name="supplier" value="${sup?if_exists}"   placeholder="请输入供货商名称"/>
             状态:
            <select name="state" id="mySelect" value="${sta?if_exists}">
                <option value="0">ALL</option>
<#--                <option value="1">待审核</option>-->
<#--                <option value="2">待入库</option>-->
<#--                <option value="3">已完成</option>-->
<#--                <option value="4">已退单</option>-->
<#--                <option value="5">已删除</option>-->
                <option value="4">正在退回</option>
                <option value="5">退单完成</option>
            </select>
            <input type="reset" value="清空条件" >
            <input type="submit" value="查询" >
        </form>
    </span>
</div>

<#--
<div align="center">
    <input type="button" onclick="location.href='/buy/toAddBack'" value="添加"  style="width: 30%; height:25%;color:lightseagreen;background-color:#FFCC00;">
</div>
-->
<br>
<br>

<div style="text-align: center" >
    <table style="margin: auto; width: 1000px ";  border="1px solid #ccc" cellspacing="0" cellpadding="0">
        <tr>
            <td>序号</td>
            <td>采购订单ID</td>
            <td>创建时间</td>
            <td>创建人</td>
            <td>供应商</td>
            <td>总金额</td>
            <td>状态</td>
            <td>操作</td>
        </tr>
        <#list backPageList.list as buy>
            <tr>
                <td>${buy_index+1}</td>
                <td>${buy.plId}</td>
                <#--<#setting date_format="yyyy-MM-dd">-->
                <td>${buy.plTime?string('yyyy-MM-dd')}</td>
                <#--<td>${buy.plPerson}</td>-->
                <td>${buy.plPerson}</td>
                <td>${buy.plSupplier}</td>
                <td>${buy.plAmount}</td>
                <#-- <td>${(buy.plState==1)?string('待审核','待入库')}</td>--><#--三元运算符样例-->
<#--                <#if buy.plState==1><td>待审核</td>-->
<#--                <#elseif buy.plState==2><td>待入库</td>-->
<#--                <#elseif buy.plState==3><td>已完成</td>-->
                <#if buy.plState==4><td>正在退回</td>
                <#elseif buy.plState==5><td>退单完成</td>
                </#if>

                <#if buy.plState==4><td><a href="/buy/checkBack?nowId=${buy.plId}&nowState=${buy.plState}" style="text-decoration: none">查看</a><#--退回中，可以撤销-->
                <#elseif buy.plState==5><td><a href="/buy/checkBack?nowId=${buy.plId}&nowState=${buy.plState}" style="text-decoration: none">查看</a>   <#--已完成退单-->
                    <#--<#elseif buy.plState==5><a href="/buy/checkBack?nowId=${buy.plId}&nowState=${buy.plState}" style="text-decoration: none">查看</a>-->
                    <#--<a href="/buy/edit?nowId=${buy.plId}" style="text-decoration: none">&nbsp;&nbsp;编辑</a>--></td>
                <#--<#elseif buy.plState==2><td><a href="/buy/check?nowId=${buy.plId}&nowState=${buy.plState}" style="text-decoration: none">查看</a>--><#--<a href="/buy/backOrder?nowId=${buy.plId}" style="text-decoration: none">&nbsp;&nbsp;退单</a>--></td>
                <#--<#elseif buy.plState==3><td><a href="/buy/check?nowId=${buy.plId}&nowState=${buy.plState}" style="text-decoration: none">查看</a></td>--><#--已完成  查看-->

                </#if>
            </tr>
        </#list>
    </table>
</div>
<div colspan="20" style="text-align: center;">
    <a style="text-decoration: none" href="/buy/getBackList?pageIndex=1">首页</a>
    &nbsp;&nbsp;&nbsp;

    <a style="text-decoration: none" href="/buy/getBackList?pageIndex=${backPageList.prePage}">上一页</a>
    <a style="text-decoration: none" href="/buy/getBackList?pageIndex=${backPageList.nextPage}">下一页</a>
    &nbsp;&nbsp;&nbsp;

    &nbsp;&nbsp;
    <a style="text-decoration: none" href="/buy/getBackList?pageIndex=${backPageList.pages}">尾页</a>
    &nbsp;&nbsp;&nbsp;
    当前${backPageList.pageNum} / ${backPageList.pages}页 &nbsp;&nbsp;&nbsp;每页${backPageList.pageSize}条
    <input type="hidden" name="pages" value="${backPageList.pages}">
</div>
</body>
</html>